// pages/index/index.js
Page({
    data: {
      list: [],
      isDialogShow: false,
      isScroll: true
    },
    onLoad: function(options) {
      console.log("排行榜", options.id);
      var that = this;
      wx.request({
        url: 'http://101.35.134.51:8080/base-in-back-end/app/wechatRanks/list' ,
        method: 'GET',
        header: {
          Authorization: 'Bearer' + wx.getStorageSync("token"),
        },
        success: function(res) {
          console.log("排行榜", res.data.data);
          if (res.data.data != null) {
            that.setData({
              list: res.data.data,
            })
          } else {
            wx.showModal({
              title: '提示',
              content: '当天没有数据',
              showCancel: false,
              success: function(res) {
                if (res.confirm) {
                  console.log('用户点击确定');
                  wx.navigateBack({
                    delta: 1 //小程序关闭当前页面返回上一页面
                  })
                }
              }
            })
          }
        }
      })
    },
    onReady: function() {
      // 页面渲染完成
    },
    onShow: function() {
  
    },
    onHide: function() {
      // 页面隐藏
    },
    onUnload: function() {
      // 页面关闭
    },
    onPullDownRefresh:function(){
    }
  })